﻿<Window x:Class="Microsoft.Research.ScientificWorkflow.UIDesigner.Import.AssemblySelectDialog"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    Width="400" Height="300" WindowStyle="None" ResizeMode="NoResize" WindowStartupLocation="CenterOwner" ShowInTaskbar="False"
    xmlns:trident="clr-namespace:Microsoft.Research.ScientificWorkflow.UIDesigner" AutomationProperties.AutomationId="AssemblySelector">
    <Window.Resources>
        <trident:MinWidthConverter x:Key="MinWidthConverter"/>
        <Style x:Key="PopupCloseButton" BasedOn="{x:Null}" TargetType="{x:Type Button}">
                <Setter Property="Template">
                    <Setter.Value>
                        <ControlTemplate TargetType="{x:Type Button}">
                            <Grid>
                                <Rectangle Fill="#FFCCCCCC" Stroke="{x:Null}" RadiusX="4.5" RadiusY="4.5" x:Name="rectangle"/>
                                <Rectangle Fill="#FF4F4F4F" Stroke="{x:Null}" RadiusX="0" RadiusY="0" Margin="8,3.5,7,3.5" RenderTransformOrigin="0.5,0.5">
                                    <Rectangle.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="1" ScaleY="1"/>
                                            <SkewTransform AngleX="0" AngleY="0"/>
                                            <RotateTransform Angle="-34.039"/>
                                            <TranslateTransform X="0" Y="0"/>
                                        </TransformGroup>
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                                <Rectangle Fill="#FF4F4F4F" Stroke="{x:Null}" RadiusX="0" RadiusY="0" RenderTransformOrigin="0.5,0.5" Margin="8,3.5,7,3.5">
                                    <Rectangle.RenderTransform>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="-1" ScaleY="1"/>
                                            <SkewTransform AngleX="0" AngleY="0"/>
                                            <RotateTransform Angle="34.039"/>
                                            <TranslateTransform X="0" Y="0"/>
                                        </TransformGroup>
                                    </Rectangle.RenderTransform>
                                </Rectangle>
                            </Grid>
                            <ControlTemplate.Triggers>
                                <Trigger Property="IsFocused" Value="True"/>
                                <Trigger Property="IsDefaulted" Value="True"/>
                                <Trigger Property="IsMouseOver" Value="True">
                                    <Setter Property="Fill" TargetName="rectangle" Value="#FFADADAD"/>
                                </Trigger>
                                <Trigger Property="IsPressed" Value="True"/>
                                <Trigger Property="IsEnabled" Value="False"/>
                            </ControlTemplate.Triggers>
                        </ControlTemplate>
                    </Setter.Value>
                </Setter>
            </Style>         
        <ControlTemplate x:Key="TextBoxControlTemplate1" TargetType="{x:Type TextBox}">
                <Grid>
                    <Border HorizontalAlignment="Stretch" Background="#FFFFFFFF" BorderBrush="#FFC8C8C8" CornerRadius="2,0,0,2" BorderThickness="1,1,0,1">
                        <ScrollViewer x:Name="PART_ContentHost" SnapsToDevicePixels="{TemplateBinding SnapsToDevicePixels}"/>
                    </Border>
                </Grid>
            </ControlTemplate>
        <DataTemplate x:Key="HeaderTemplateArrowUp">
            <DockPanel x:Name="testdock" HorizontalAlignment="Stretch" MinWidth="{Binding Converter={StaticResource MinWidthConverter}, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GridViewColumnHeader}}, Path=Column.MinimumWidth}">
                <TextBlock DockPanel.Dock="Left" HorizontalAlignment="Left" Text="{Binding}" Margin="0,0,3,0"/>
                <Path DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" Width="8.818" Height="5.587" Stretch="Fill" Stroke="#FF2C4D5C" Data="M286.61806,19.081601 L294.03351,11.059422 301.10921,19.06093 z">
                    <Path.Fill>
                        <LinearGradientBrush EndPoint="0.599,0.663" StartPoint="0.329,0.15">
                            <GradientStop Color="#FF0A4866" Offset="0"/>
                            <GradientStop Color="#FF8ED0EC" Offset="1"/>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
            </DockPanel>
        </DataTemplate>
        <DataTemplate x:Key="HeaderTemplateArrowDown">
            <DockPanel x:Name="testdock" MinWidth="{Binding Converter={StaticResource MinWidthConverter},  RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GridViewColumnHeader}}, Path=Column.MinimumWidth}">
                <TextBlock DockPanel.Dock="Left" HorizontalAlignment="Left" Text="{Binding}" Margin="0,0,3,0"/>
                <Path DockPanel.Dock="Right" HorizontalAlignment="Right" VerticalAlignment="Center" Width="8.818" Height="5.587" Stretch="Fill" Stroke="#FF2C4D5C" Data="M286.61806,19.081601 L294.03351,11.059422 301.10921,19.06093 z" RenderTransformOrigin="0.5,0.5">
                    <Path.RenderTransform>
                        <TransformGroup>
                            <ScaleTransform ScaleX="1" ScaleY="-1"/>
                            <SkewTransform AngleX="0" AngleY="0"/>
                            <RotateTransform Angle="0"/>
                            <TranslateTransform X="0" Y="0"/>
                        </TransformGroup>
                    </Path.RenderTransform>
                    <Path.Fill>
                        <LinearGradientBrush EndPoint="0.599,0.663" StartPoint="0.329,0.15">
                            <GradientStop Color="#FF0A4866" Offset="0"/>
                            <GradientStop Color="#FF8ED0EC" Offset="1"/>
                        </LinearGradientBrush>
                    </Path.Fill>
                </Path>
            </DockPanel>
        </DataTemplate>
        <DataTemplate x:Key="HeaderTemplateTransparent">
            <DockPanel MinWidth="{Binding Converter={StaticResource MinWidthConverter},  RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type GridViewColumnHeader}}, Path=Column.MinimumWidth}">
                <TextBlock HorizontalAlignment="Left" Text="{Binding}"/>
                <Path x:Name="arrow" StrokeThickness="1" Fill="Transparent" Data="M 5,5 L 10,10 L 15,5 L 5,5"/>
            </DockPanel>
        </DataTemplate>
    </Window.Resources>
        <Grid>
            <Border BorderBrush="#FFBDBDBD" BorderThickness="1,1,2,2" CornerRadius="4,4,4,4">
                <Border.Background>
                    <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                        <GradientStop Color="#FFF7F7F7" Offset="0"/>
                        <GradientStop Color="#FFF1F1F1" Offset="1"/>
                    </LinearGradientBrush>
                </Border.Background>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="28"/>
                        <RowDefinition Height="*"/>
                        <RowDefinition Height="38"/>
                    </Grid.RowDefinitions>
                    <Border MouseLeftButtonDown="BorderMouseLeftButtonDown" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Width="Auto" Grid.Row="0" CornerRadius="4,4,0,0">
                        <Border.Background>
                            <LinearGradientBrush EndPoint="0.5,1" StartPoint="0.5,0">
                                <GradientStop Color="#FFF7F7F7" Offset="0"/>
                                <GradientStop Color="#FFE9E9E9" Offset="1"/>
                            </LinearGradientBrush>
                        </Border.Background>
                        <Grid>
                            <TextBlock HorizontalAlignment="Left" Margin="5,0,0,0" VerticalAlignment="Center" FontSize="14" Foreground="#FF5F5F5F" Text="Select Existing Files" TextWrapping="Wrap"/>
						<Button HorizontalAlignment="Right" Margin="0,5.5,5,5.5" Style="{DynamicResource PopupCloseButton}" Width="17" Click="CancelButtonClick"/>
					</Grid>
                    </Border>
                    <Button HorizontalAlignment="Right" Width="70" IsCancel="True" Content="Cancel" Click="CancelButtonClick" Margin="0,0,10,0" VerticalAlignment="Center" Grid.Row="2" AutomationProperties.AutomationId="CancelButton"/>
                    <Button x:Name="okButton" IsDefault="True" HorizontalAlignment="Right" Width="70" Click="OKButtonClick" Content="OK" Margin="0,0,85,0" VerticalAlignment="Center" Grid.Row="2" AutomationProperties.AutomationId="OkButton"/>
                    <Border Grid.Row="1" Background="#FFFFFFFF">
                        <StackPanel>
                            <trident:TextBoxWatermark WatermarkText="Enter filename" x:Name="txtBxSearch" TextWrapping="NoWrap" 
                                                      Margin="10,12,15,2" BorderBrush="#FFBEC7CA" HorizontalAlignment="Stretch" MaxLength="75" 
                                                      AutomationProperties.Name="ANameJobNameText"/>
                            <trident:SortListView SelectionMode="Single" IsTextSearchEnabled="True" TextSearch.TextPath="Name" x:Name="assemblyListView" SelectionChanged="AssemblyListViewSelectionChanged" IsSynchronizedWithCurrentItem="True" BorderBrush="#FFCCCCCC" Margin="10,10,10,10" Height="180" ScrollViewer.VerticalScrollBarVisibility="Visible" AutomationProperties.AutomationId="AssemblyListView">
                                <trident:SortListView.View>
                                    <GridView>
                                        <trident:SortListViewColumn SortByDefault="True" DefaultSortDirection="Ascending" Width="150" MinimumWidth="130" SortProperty="Name" Header="Name" DisplayMemberBinding="{Binding Path=DisplayName}"/>
                                        <trident:SortListViewColumn MinimumWidth="80" Width="100" SortProperty="ImportedBy" Header="Imported By" DisplayMemberBinding="{Binding Path=ImportedBy}" />
                                        <trident:SortListViewColumn MinimumWidth="80" Width="100" SortProperty="ImportedTime" Header="Imported Date" DisplayMemberBinding="{Binding Path=ImportedTime}"/>
                                    </GridView>
                                </trident:SortListView.View>
                            </trident:SortListView>
                        </StackPanel>
                    </Border>
                </Grid>
            </Border>
        </Grid>
</Window>
